Event Binding 
All objects within your Visaj design can be linked together using events.
Events are messages which can be sent by one component and
may be received by another. When a button is pressed, for
example, a message is sent to that effect and any objects which have registered
an interest in this event receive it.
The Event Bindings list allows you to:
- Create a new event binding
- Edit an existing event
- Delete an existing event
Event Binding Editor
If you decide to edit or create a new event binding, the Event Binding Editor appears.
This consists of 4 sections:
- Source Component
- Event type
- Target Object
- Method of the Object to be called
The four buttons at the bottom of the editor navigate through the event creation
process:
- Next > - If the chosen method needs some parameters, then this button will take you to the Parameters page.
- < Previous - Once in the Parameters page, this button will return you to the event creation page.
- Finish - Saves your current event binding, and returns you to the Class Editor.
- Another - Saves your current event binding, and clears all current selections to allow you to enter another event.
The Parameter Window
On the left of the Parameter page there is a list of all the required parameters for the
chosen method. You mustclick on a parameter to set its details.
On the right of the Parameter page there are three ways of specifying the value of the selected parameter:
- Value. This is an explicit value, exactly the same as a value in the property sheet. Press the Return key after entering text.
- Event. This is only sensitive if the parameter you have selected is on the same type as the event object passed in to the source event type (or listener method).
This event object will then be passed on to the destination method.
- Code expression. This allows you to type in an arbitrary value of expression for the parameter. Bindings which use these are not active in the dynamic display.
Creating an Event Binding
For an example of how to create an event binding do the following:
- Create a small hierarchy consisting of a Frame, a Panel, and a Button.
- Click on the Event Binding tab.
- Press the New button.
- Select the Button (it should be called 'button1').
- Select actionPerformed.
- Select the Frame (it should be called 'frame1').
- Search the Method list for setTitle(java.lang.String), and select it.
- The Next > button should now be enabled - click on it.
- Click on java.lang.String.
- Click on the "Value" radio button.
- Click on the TextField and type in, "My Button was pressed!". Make
sure you press the Return key when you've finished typing in the TextField.
- Press the Finish button.
You have now "bound" an event.
button1.actionPerformed() is now bound to frame1.setTitle ("My button was pressed!").
Event bindings take effect immediately in the dynamic window unless you have provided a code expression for a target method parameter.
If you now press the Button in the dynamic window, you should see
the title of the Frame change.